package gov.pr.celepar.sentinela.admin.form;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.util.LabelValueBean;

public class BaseForm extends ActionForm implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	public static final String ACTION_PARAMETER = "acao";

	public static final String ACTION_TYPE_PARAMETER = "actionType";

	private String acao;

	private String actionType;

	private String indice;

	private String totalRegistros;

	private String limite;

	public String getIndice() {
		if (this.indice == null || this.indice.trim().equals(""))
			return "1";
		return this.indice;
	}

	public void setIndice(String indice) {
		this.indice = indice;
	}

	public String getAcao() {
		return this.acao;
	}

	public void setAcao(String acao) {
		this.acao = acao;
	}

	public String getActionType() {
		return actionType;
	}

	public void setActionType(String action) {
		this.actionType = action;
	}

	public String getTotalRegistros() {
		return this.totalRegistros;
	}

	public void setTotalRegistros(String totalRegistros) {
		this.totalRegistros = totalRegistros;
	}

	public void setLimite(String limite) {
		this.limite = limite;
	}

	public String getLimite() {
		return this.limite;
	}

	public void reset(ActionMapping mapping, HttpServletRequest request) {
		List<LabelValueBean> valoresLimite = new ArrayList<LabelValueBean>();
		valoresLimite.add(new LabelValueBean("50", "50"));
		valoresLimite.add(new LabelValueBean("100", "100"));
		valoresLimite.add(new LabelValueBean("200", "200"));
		valoresLimite.add(new LabelValueBean("500", "500"));
		valoresLimite.add(new LabelValueBean("1000", "1000"));
		valoresLimite.add(new LabelValueBean("2000", "2000"));
		request.setAttribute("listaValoresLimite", valoresLimite);
	}
}
